/* GUI CONVERTED from rqcrp.p (converter v1.76) Thu Aug  2 17:25:13 2001 */
/* rqcrp.p - Category Report                                                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/* $Revision: 1.4.1.4 $                                                         */
/*V8:ConvertMode=FullGUIReport                                              */

/* REVISION 8.5       LAST MODIFIED: 04/15/97  BY: *J1Q2* Patrick Rowan     */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane        */
/* REVISION: 8.6E     LAST MODIFIED: 05/06/98   BY: *K1PH* A. Shobha        */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan       */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Jeff Wootton     */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* Old ECO marker removed, but no ECO header exists *F0PN*                  */
/* $Revision: 1.4.1.4 $    BY: Tiziana Giustozzi    DATE: 07/03/01 ECO: *N104*      */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*!
 ----------------------------------------------------------------------------
 DESCRIPTION: Create category report.
              Supports the multi-line Purchase Requisition Module of MFG/PRO.

Notes:
============================================================================
!*/

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rqcrp_p_1 "Print Details"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqcrp_p_2 "From!Account"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqcrp_p_3 "To!Account"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqcrp_p_4 "From!Sub-Acct"
/* MaxLen: Comment: Beginning sub-account of range */

&SCOPED-DEFINE rqcrp_p_5 "To!Sub-Acct"
/* MaxLen: Comment: Ending Sub-account of range */

&SCOPED-DEFINE rqcrp_p_6 "Account Description"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* VARIABLES */
define variable category                  like rqc_category.
define variable category1                 like rqc_category.
define variable var_acct_from             like rqcd_acct_from.
define variable var_acct_to               like rqcd_acct_to.
define variable var_acct_from_desc        like ac_desc.
define variable var_acct_to_desc          like ac_desc.

/* LOGICALS */
define variable print_details             like mfc_logical
   label {&rqcrp_p_1}.

/* COUNTERS */
define variable rqcd_det_cntr as integer.
define variable ac_mstr_cntr as integer.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
category      colon 15
   category1     colon 40 label {t001.i}
   skip(1)
   print_details colon 30
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).
{wbrp01.i}


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   bcdparm = "".
   {mfquoter.i category }
   {mfquoter.i category1}
   {mfquoter.i print_details}

   if  category1 = hi_char then category1 = ''.
   if  c-application-mode <> 'WEB' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update
      &fields = "category category1 print_details"
      &frm = "a"}

   if c-application-mode <> 'WEB' or
      ( c-application-mode = 'WEB' and
      c-web-request begins 'DATA') then do:
      hide frame b no-pause.
      clear frame b all no-pause.

      if category1 = '' then category1 = hi_char.
   end.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:




   {mfphead.i}

   for each rqc_mstr where
         rqc_category >= category and
         rqc_category <= category1
         no-lock,
         each rqcd_det where
         rqcd_category = rqc_category
         no-lock
         break by rqc_category
      with frame c width 132 down:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame c:handle).

      if page-size - line-counter < 3 then page.

      find ac_mstr where
         ac_code = rqcd_acct_from
         no-lock no-error.
      if  available(ac_mstr) then
         var_acct_from_desc = ac_desc.
      else
         var_acct_from_desc = "".

      find ac_mstr where
         ac_code = rqcd_acct_to
         no-lock no-error.
      if available(ac_mstr) then
         var_acct_to_desc = ac_desc.
      else
         var_acct_to_desc = "".

      if first-of(rqc_category) then
      display
         rqc_category
         rqc_desc WITH STREAM-IO /*GUI*/ .

      display
         rqcd_acct_from         column-label {&rqcrp_p_2}
         rqcd_sub_from          column-label {&rqcrp_p_4}
         var_acct_from_desc
         column-label {&rqcrp_p_6}
         rqcd_acct_to           column-label {&rqcrp_p_3}
         rqcd_sub_to            column-label {&rqcrp_p_5}
         var_acct_to_desc
         column-label {&rqcrp_p_6} WITH STREAM-IO /*GUI*/ .

      var_acct_from = rqcd_acct_from.
      if rqcd_acct_to = "" then
         var_acct_to = hi_char.
      else
         var_acct_to = rqcd_acct_to.

      if print_details then do:
         ac_mstr_cntr = 0.
            for each ac_mstr where
                  var_acct_from <> var_acct_to and
                  ac_code >= rqcd_acct_from and
                  ac_code <= var_acct_to and
                  ac_active no-lock with frame d:
               /* SET EXTERNAL LABELS */
               setFrameLabels(frame d:handle).
               display
                  space(45)
                  ac_code
                  ac_desc
                  column-label {&rqcrp_p_6} WITH STREAM-IO /*GUI*/ .
               ac_mstr_cntr = ac_mstr_cntr + 1.
            end.  /* for each ac_mstr */
      end.  /* if print_details */

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

   end.

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.  /* repeat */
{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" category category1 print_details "} /*Drive the Report*/
